<?php 
	session_start();
	date_default_timezone_set('America/New_York');
?>

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
  <meta charset="utf-8">

  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
       More info: h5bp.com/b/378 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>Streaming Radio Service - Team Four</title>
  <meta name="description" content="">
  <meta name="author" content="">

  <!-- Mobile viewport optimized: j.mp/bplateviewport -->
  <meta name="viewport" content="width=device-width,initial-scale=1">

  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->

  <!-- CSS: implied media=all -->
  <!-- CSS concatenated and minified via ant build script-->
  <link rel="stylesheet" href="css/style.css">
  <!-- end CSS-->

  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->

  <!-- All JavaScript at the bottom, except for Modernizr / Respond.
       Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
       For optimal performance, use a custom Modernizr build: www.modernizr.com/download/ -->
  <script src="js/libs/modernizr-2.0.6.min.js"></script>

</head>

<body onLoad="init()">

<div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;">
<img src="loading.gif" border=0>WEJWEHJKQJWHEJKWHQJK!</div>

  <div id="container">
    <header>
		The Awesome Radio Streaming Service.
    </header>
    <div id="main" role="main">
    
    	<div id="description">
    		If you have found yourself at this web page then you are most likely named <strong>Andy Pletch</strong>. If that be the case, then please enjoy! It's quite simple. Either choose to schedule a radio station for tuning at a specific time or scan for available stations now.
    	</div>
 	
	<div id="lower-content">
	
	<div class="horizontal-rule"></div>
		<div id="main-stuff">
		
			<?php $authed = false; ?>
		
			<?php if(!isset($_SESSION['email'])) { ?>
				
				<div style="color:#999999;text-shadow: 0 1px 0 #fff;font-size:12px;float:left;margin-right:5px;margin-top:3px;">Please enter your email to continue! </div>
				<div style="float:left;">
					<form name="input" action="validate_email.php" method="get">
						<input type="text" placeholder="Email (then hit enter)" name="email" /><br />
					</form> 
				</div>
				<div style="clear:both"></div>
			
			<?php } else { ?>
		
				<div style="color:#999999;text-shadow: 0 1px 0 #fff;font-size:12px;float:left;">You are logged in as <span style="color:#666666"> <? if(isset($_SESSION['email'])) { echo $_SESSION['email']; } else { ?>Guest<? } ?> </span><a href="index.php?page_option=3" class="button">Kill Session</a></div>
				<div style="float:right;"><a href="index.php?page_option=0" class="button" id="show-stations">Available Stations </a> <a href="index.php?page_option=0" class="button no-margin">Schedule A Tune</a> </div>
				<div style="clear:both;"></div>
				
				<div id="available-stations">
					<?php if(isset($_GET["page_option"])) { ?>
						<?php 
							switch ($_GET["page_option"]) 
							{
							    case 0:
							        include('controllers/scan_controller.php');
							        $scan = new scan();
							        $scan->scan_now();
							        break;
							    case 1:
							        include('controllers/schedule_controller.php');
							        break;
							    case 2:
							        include('controllers/tune_controller.php');
							        //$tune = new tune($_GET["group1"]);
							        echo "You've chosen 2.";
							        break;
							    case 3:
							    	session_destroy();
									echo '<meta http-equiv="refresh" content="1"/>';
							        break;
							}
						?>
					<?php } ?>
				</div>
				
			<?php } ?>
							
		</div>
	</div>

    </div>
    <footer>

    </footer>
  </div> <!--! end of #container -->

  <!-- JavaScript at the bottom for fast page loading -->

  <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
  <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> -->
  <script type="text/javascript" src="js/jq1.7.js"></script>
  <!--<script type="text/javascript" src="js/form.js"></script>-->
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
	
  <!-- Change UA-XXXXX-X to be your site's ID -->
  <script>
    window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
    Modernizr.load({
      load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
    });
  </script>
  
 <script>
 var ld=(document.all);
  var ns4=document.layers;
 var ns6=document.getElementById&&!document.all;
 var ie4=document.all;
  if (ns4)
 	ld=document.loading;
 else if (ns6)
 	ld=document.getElementById("loading").style;
 else if (ie4)
 	ld=document.all.loading.style;
  function init()
 {
 if(ns4){ld.visibility="hidden";}
 else if (ns6||ie4) ld.display="none";
 }
 </script>
 
 <script>
	$('#show-stations').click(function() {
		$('#show-stations').append('<img src="loading.gif" height="15" width="15">');
	});
 </script>

  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
       chromium.org/developers/how-tos/chrome-frame-getting-started -->
  <!--[if lt IE 7 ]>
    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
    <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
  <![endif]-->
  
</body>
</html>